<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script setup>
import { onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';

// 使用useRouter和useRoute来获取路由实例和当前路由信息
const router = useRouter();
const route = useRoute();

// 重定向到登录页面
onMounted(() => {
  if (route.path !== '/login') {
    router.replace('/login');
  }
});
</script>